<!DOCTYPE html>
<html>
<head>
    <title>提醒统计</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="description" content="木兰湾管理系统">
    <script type="text/javascript" src="../../static/include/header-css.js"></script>
</head>
<body ontouchstart>
<div class="search_bg">
    <div class="weui-header bg-green" align="center">
        图表选择
    </div>
    <form id="search-form">
        <div class="weui-cell mulanbay_select-before ">
            <div class="weui-cell__hd"><label class="weui-label">图表类型</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" id="bussTypeList" type="text" value="" name="bussType">
            </div>
        </div>
        <div class="weui-cell mulanbay_select-before">
            <div class="weui-cell__hd"><label class="weui-label">统计图表</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" id="userNotifyList" type="text" value="">

            </div>
        </div>
        <input type="hidden" name='bussType' id="bussType" value=""/>
        <input type="hidden" name='id' id="id" value=""/>

    </form>
</div>
<a href="javascript:getJsonData();" class="weui-btn weui-btn_primary">查询</a>
<label style="color: red" id="notifyContent"></label>

<br>
<br>
<!--图表统计-->
<div class="weui-header bg-green" align="center">
    达到警告值统计
</div>
<div id="notifyAnalyseWarningContainer"
     style="width: 95%; height: 60%; margin: 0 auto">
</div>
<div class="weui-header bg-green" align="center">
    达到报警值统计
</div>
<div id="notifyAnalyseAlertContainer"
     style="width: 95%; height: 60%; margin: 0 auto">
</div>
<!--底部按钮-->
<div align="center">
    <a href="javascript:gotoTop();" class="weui-btn weui-btn_mini weui-btn_primary">返回顶部</a>
</div>
<br>
<script type="text/javascript" src="../../static/include/footer-js.js"></script>
<script type="text/javascript" src="../../static/js/echarts/echarts.min.js"></script>
<script type="text/javascript" src="../../static/js/echarts/mulanbaychart.js"></script>
<script>
    $(function() {
        loadBussTypeTree();
    });
    function getJsonData(){
        var para = form2Json("search-form");
        if(para.userNotifyId==null||para.userNotifyId==0){
            //$.alert("请选择图表");
            //return;
        }
        para.status=2;
        var url = '/userNotify/getStat';
        doAjax(para, url, 'GET',false, function(data) {
            var content =data.compareValue+' '+data.userNotify.notifyConfig.valueTypeName;
            if(data.userNotify.notifyConfig.resultType=='NAME_DATE'||data.userNotify.notifyConfig.resultType=='NAME_NUMBER'){
                content =data.name+'  '+data.compareValue+data.userNotify.notifyConfig.valueTypeName;
            }
            document.getElementById("notifyContent").innerText='统计值：'+content;
            var warnData={};
            warnData.value = getPercent(data.compareValue,data.userNotify.warningValue);
            warnData.name='达到比例';
            warnData.title='达到警告比例';
            warnData.subTitle='当前值:'+data.compareValue+",警告配置:"+data.userNotify.warningValue+',单位:'+data.userNotify.notifyConfig.valueTypeName;
            createGaugeChartEnhanced(warnData,'notifyAnalyseWarningContainer');
            var alertData={};
            alertData.value = getPercent(data.compareValue,data.userNotify.alertValue);
            alertData.name='达到比例';
            alertData.title='达到报警比例';
            alertData.subTitle='当前值:'+data.compareValue+",报警配置:"+data.userNotify.alertValue+',单位:'+data.userNotify.notifyConfig.valueTypeName;
            createGaugeChartEnhanced(alertData,'notifyAnalyseAlertContainer');
        });
    }
    function loadBussTypeTree() {
        var url = '/common/getEnumTree?enumClass=BussType';
        loadSelectList(url,'bussTypeList','bussType','选择类型',true,true,function (ov,nv) {
            loadUserNotifyTree();
        },function (data) {
            loadUserNotifyTree();
        });
    }
    function loadUserNotifyTree() {
        var relatedBeans = $('#bussType').val();
        var url = '/userNotify/getUserNotifyTreeNm?relatedBeans='+relatedBeans;
        loadSelectList(url,'userNotifyList','id','选择图表',true,true,function (ov,nv) {
            getJsonData();
        },function (data) {
            getJsonData();
        });

    }
</script>
</body>
</html>